package day4;
//测试Object类
public class TestObject {
    public static void main(String[] args) {
        //TestObject t = new TestObject();
        //第一类：对象类
        TestObject t1 = new TestObject();
        TestObject t2 = t1;
        TestObject t3 = new TestObject();
        System.out.println(t1.hashCode());
        System.out.println(t2.hashCode());
        System.out.println(t3.hashCode());
        //第二类：基本类型封装类 Integer、Long、Byte、Float
        Integer num = 1000;
        Integer num2 = new Integer(1000);
        Long num3 = 1000l;
        System.out.println(num.hashCode());
        System.out.println(num2.hashCode());
        System.out.println(num3.hashCode());
        //第三类：String类,可能会出现bug,
        //哈希冲突：值是不同的 但是hashcode反而相同
        String s = "java";
        String s2 = new String("java");
        //存在哈希冲突
        String s3 = "重地";
        String s4 = "通话";
        System.out.println(s3.hashCode());
        System.out.println(s4.hashCode());
    }
}
